﻿namespace Example.Structural.Adapter
{
    using System;
    using System.Collections.ObjectModel;
    using System.Diagnostics.CodeAnalysis;

    public sealed class ConvertibleCollection : Collection<IConvertible>
    {
        [SuppressMessage("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods", Justification = "The method hiding is intentional.")]
        public void Add(object item)
        {
            var convertible = item as IConvertible;
            base.Add(convertible ?? new ConvertibleAdapter(item));
        }
    }
}